<script setup>
import { ref } from 'vue'
import { Select } from '@element-plus/icons-vue'

const props = defineProps({
  value: {
    type: Boolean,
    default: false
  },
  callback: {
    type: Function,
    default: () => {}
  }
})

const changeCheckFun = () => {
  props.callback(!props.value)
}
</script>

<template>
  <div :class="{ 'check-box-wrapper': true, checked: props.value }" @click="changeCheckFun">
    <el-icon class="icon" v-if="props.value" color="var(--mainColor);" :size="13"><Select /></el-icon>
  </div>
</template>

<style lang="scss" scoped>
.check-box-wrapper {
  width: 18px;
  height: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 3px;
  border: 2px solid #dcdfe6;
  cursor: pointer;
}
.checked {
  border: 2px solid var(--mainColor);
  background-color: var(--mainColor);

  :deep(.icon) {
    color: #fff;
  }
}
</style>
